package antlr4.definitive.d4_expr.d4_5_2_insertSerialID.run;

import antlr4.definitive.d4_expr.d4_5_2_insertSerialID.gen.JavaBaseListener;
import antlr4.definitive.d4_expr.d4_5_2_insertSerialID.gen.JavaParser;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.TokenStreamRewriter;

public class InsertSerialIDListener extends JavaBaseListener {
    TokenStreamRewriter rewriter;
    public InsertSerialIDListener(TokenStream tokenStream) {
        rewriter = new TokenStreamRewriter(tokenStream);
    }

    @Override
    public void enterClassBody(JavaParser.ClassBodyContext ctx) {
        String field = "\n\tpublic static final long serialVersionUID = 1L;";
        rewriter.insertAfter(ctx.start,field);
    }
}
